#include <iostream>

using namespace std;

void test1(){
    int p[][4] = {{1},{3,2},{4,5,6},{0}};
    cout << p[1][2] << endl;
}

void test2(){
    int a = 21;
    a ^= (1<<5)-1;
    cout << a << endl;
}

void test3(){
    int i, j, k = 0;
    for (i = 0, j = -1; j = 0; i++, j++) {
        k++;
    }
    cout << k << endl;
}

void test4(){
    int a = 11|10;
}

void test5(){
    int a = 1, b = 2, c = 3, d = 0;
    if(a == 1 && b++ == 2){
        if(b != 2 | c-- != 3){
            cout<<a<<b<<c<<endl;
        } else
            cout<<a<<b<<c<<endl;
    } else
        cout<<a<<b<<c<<endl;
}

void test6(){
    printf("%s, %1.1s\n","computer","computer");
}

#include <vector>
#include <algorithm>

void Test1(){
    int n = 0;
    cin >> n;
    long long sum = 0;
    vector<int> v;
    v.resize(3*n);
    for (int i = 0; i < 3 * n; ++i) {
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    for (int i = 0; i < n; ++i) {
        sum += v[v.size() - 2*(i+1)];
    }
    cout << sum << endl;
}

#include <string>

void Test2(){
    string str1;
    string str2;
    getline(cin,str1);
    getline(cin,str2);
    for (int i = 0; i < str1.size(); ++i) {
        if(str2.find(str1[i]) == -1)
            cout << str1[i];
    }
}

int main() {
    //test6();
    Test2();
    return 0;
}
